package com.luoye.sh.ws.resource;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Created by Administrator on 2018/5/31.
 */
@Api(description = "打招呼",value = "hello")
@Component
@Path("/hi")
public class HiResource {

    @Value("${server.port}")
    String port;

    @ApiOperation(value="说出用户名", notes="根据名称获取名称和服务端口")
    @ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "String", paramType = "query")
    @GET
    @Path("/say")
    @Consumes(MediaType.APPLICATION_JSON)//标注可接受请求的MIME媒体类型
    @Produces(MediaType.APPLICATION_JSON)//标注返回的MIME媒体类型
    public String say(@RequestParam String name){

        return "hi "+name+",i am from port:" +port;
    }

}
